package com.hqq.behaviour.memento;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Stack;

/**
 * App
 * Created by heqianqian on 2017/6/28.
 */
public class App {

    private static final Logger LOGGER = LoggerFactory.getLogger(App.class);

    /**
     * Program entry point
     */
    public static void main(String[] args) {
        Stack<StarMemento> starMementos = new Stack<>();

        LOGGER.info("========Before===========");
        Star star = new Star(100000, 500000, StarType.SUN);
        LOGGER.info(star.toString());
        starMementos.add(star.getStarMemento());
        star.timePassed();
        LOGGER.info(star.toString());
        starMementos.add(star.getStarMemento());
        star.timePassed();
        LOGGER.info(star.toString());
        starMementos.add(star.getStarMemento());
        star.timePassed();
        LOGGER.info(star.toString());
        starMementos.add(star.getStarMemento());
        star.timePassed();
        LOGGER.info(star.toString());
        starMementos.add(star.getStarMemento());

        LOGGER.info("========After===========");
        while (starMementos.size() > 0) {
            star.setStarMemento(starMementos.pop());
            LOGGER.info(star.toString());
        }
    }

}
